﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace YiYiTong.Rocket.ManageWeb
{
    public class JsHepler
    {

        /// <summary>
        /// 返回自定义js
        /// </summary>
        /// <param name="message">弹出框内容</param>
        /// <param name="isJump">是否跳转</param>
        /// <returns></returns>
        public static string GetJSMsg(string message, bool isJump, string url)
        {
            StringBuilder strJs = new StringBuilder();
            strJs.Append("<!DOCTYPE html>");
            strJs.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
            strJs.Append("<head>");
            strJs.Append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
            strJs.Append("<title></title>");
            strJs.Append("<link href=\"/Css/assets/css/bui-min.css\" rel=\"stylesheet\" />");
            strJs.Append("<link href=\"/Css/assets/css/dpl-min.css\" rel=\"stylesheet\" />");
            strJs.Append("<script src=\"/Css/assets/js/jquery-1.8.1.min.js\"></script>");
            strJs.Append("<script src=\"/Css/assets/js/bui-min.js\"></script>");
            strJs.Append("<script src=\"/Css/assets/js/message/sea.js\"></script>");
            strJs.Append("<script src=\"/Css/assets/js/message/config.js\"></script>");
            strJs.Append("</head>");
            strJs.Append("<body>");
            strJs.Append("</body>");
            strJs.Append("</html>");
            strJs.Append("<script>");
            strJs.Append("BUI.use('bui/overlay', function (overlay) {");
            strJs.Append("$(function () {");
            strJs.Append(" BUI.Message.Alert('" + message + "', function () {");
            if (!isJump)
                strJs.Append("history.go(-1);");
            else
                strJs.Append("window.parent.location.href = '" + url + "'");
            strJs.Append("  }, 'warning');");
            strJs.Append("  });");
            strJs.Append(" });");
            strJs.Append("</script>");
            return strJs.ToString();
        }
    }
}